﻿using FluentNHibernate.Mapping;
using Romantics.Domain.Objects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Romantics.Domain.Mappings
{
    class CategoryMap : ClassMap<Category>
    {
        public CategoryMap()
        {
            Id(x => x.ID);

            Map(x => x.Name)
                .Length(100)
                .Not.Nullable();

            Map(x => x.URL)
                .Length(100)
                .Not.Nullable();

            Map(x => x.Meta)
                .CustomType("StringClob")
                .CustomSqlType("NVARCHAR(MAX)");

            HasMany(x => x.Hikes)
                .Inverse()
                .KeyColumn("CATEGORY_ID");
        }
    }
}
